<?php

/**
 * Dos form base class.
 *
 * @method Dos getObject() Returns the current form's model object
 *
 * @package    Amman to London
 * @subpackage form
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDosForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'university_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('University'), 'add_empty' => true)),
      'course_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'add_empty' => true)),
      'name_en'       => new sfWidgetFormInputText(),
      'name_ar'       => new sfWidgetFormInputText(),
      'zip'           => new sfWidgetFormInputText(),
      'video'         => new sfWidgetFormInputText(),
      'rating'        => new sfWidgetFormInputText(),
      'times_rated'   => new sfWidgetFormInputText(),
      'cover_image'   => new sfWidgetFormInputText(),
      'is_featured'   => new sfWidgetFormInputCheckbox(),
      'price'         => new sfWidgetFormInputText(),
      'is_free'       => new sfWidgetFormInputCheckbox(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'university_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('University'), 'required' => false)),
      'course_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'required' => false)),
      'name_en'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'name_ar'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'zip'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'video'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'rating'        => new sfValidatorNumber(array('required' => false)),
      'times_rated'   => new sfValidatorInteger(array('required' => false)),
      'cover_image'   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'is_featured'   => new sfValidatorBoolean(array('required' => false)),
      'price'         => new sfValidatorNumber(array('required' => false)),
      'is_free'       => new sfValidatorBoolean(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('dos[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Dos';
  }

}
